package com.salon.client.beans;

public class MaterialBean extends ParentBean {
	private String name;
	private String decs;
	private String code;
	private String made;
	private boolean isConted;
	private int weight;
	private float cost; 
	
	public int getWeight() {
		return weight;
	}
	public void setWeight(int weight) {
		this.weight = weight;
	}
	public float getCost() {
		return cost;
	}
	public void setCost(float cost) {
		this.cost = cost;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDecs() {
		return decs;
	}
	public void setDecs(String decs) {
		this.decs = decs;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMade() {
		return made;
	}
	public void setMade(String made) {
		this.made = made;
	}
	public boolean getIsConted() {
		return isConted;
	}
	public void setIsConted(boolean isConted) {
		this.isConted = isConted;
	}
	
	public String getDisplayF() {
		String res = "";
		if ((code != null) && (!code.isEmpty())) {
			res += code;
			res += " ";
		}
		if (name != null) {
			res += name;
			res += " ";
		}
		res += getContedAsString() + " ";
		res += cost;
		res += " руб.";
		
		return res;
	}
	
	public String getIsContedAsString() {
		if (isConted) {
			return "штук";
		}
		else {
			return "грамм";
		}
	}
	
	public String getContedAsString() {
		return weight + " " + getIsContedAsString();
	}
	
	public IncomeMaterialsBean makeIncomeBean(IncomeMaterialsBean clone) {
		if (clone == null) {
			clone = new IncomeMaterialsBean();
		}
		
		clone.setName(name);
		clone.setCode(code);
		clone.setWeight(weight);
		clone.setConted(isConted);
		clone.setMaterialId(getId());
		
		return clone;
	}
}
